package com.authorization.demo.controller;

import com.authorization.demo.entity.RoleTable;
import com.authorization.demo.service.CronJobService;
import com.authorization.demo.service.RoleTableService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;

import javax.annotation.Resource;
import java.util.Date;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

/**
 * @Remarks: 执行定时任务
 * @ClassName: CronJobController
 * @Author: Micora
 * @CreateTime: 2022/8/1
 */
@Controller
@Component
public class CronJobController {
    @Resource
    private CronJobService cronJobService;

    /**
     * 定时执行更新应该过期的角色
     */
    @Scheduled(fixedRate = 1000 * 60 * 10) // 每十分钟执行一次
    public void updateRoleTable() {
        cronJobService.updateRoleTable();
    }
}
